var _typeof2 = require("../../../../@babel/runtime/helpers/typeof");

(function(i, t) {
    "function" == typeof define && define.amd ? define([], t) : "function" == typeof require && "object" == (typeof module === "undefined" ? "undefined" : _typeof2(module)) && module && module.exports ? module.exports = t() : (i.dcodeIO = i.dcodeIO || {}).Long = t();
})(void 0, function() {
    "use strict";
    function i(i, t, n) {
        this.low = 0 | i, this.high = 0 | t, this.unsigned = !!n;
    }
    function t(i) {
        return !0 === (i && i.__isLong__);
    }
    i.prototype.__isLong__, Object.defineProperty(i.prototype, "__isLong__", {
        value: !0,
        enumerable: !1,
        configurable: !1
    }), i.isLong = t;
    var n = {}, e = {};
    function h(i, t) {
        var h, s, u;
        return t ? (u = 0 <= (i >>>= 0) && i < 256) && (s = e[i]) ? s : (h = r(i, (0 | i) < 0 ? -1 : 0, !0), 
        u && (e[i] = h), h) : (u = -128 <= (i |= 0) && i < 128) && (s = n[i]) ? s : (h = r(i, i < 0 ? -1 : 0, !1), 
        u && (n[i] = h), h);
    }
    function s(i, t) {
        if (isNaN(i) || !isFinite(i)) return t ? v : c;
        if (t) {
            if (i < 0) return v;
            if (i >= a) return b;
        } else {
            if (i <= -d) return q;
            if (i + 1 >= d) return p;
        }
        return i < 0 ? s(-i, t).neg() : r(i % f | 0, i / f | 0, t);
    }
    function r(t, n, e) {
        return new i(t, n, e);
    }
    i.fromInt = h, i.fromNumber = s, i.fromBits = r;
    var u = Math.pow;
    function o(i, t, n) {
        if (0 === i.length) throw Error("empty string");
        if ("NaN" === i || "Infinity" === i || "+Infinity" === i || "-Infinity" === i) return c;
        if ("number" == typeof t ? (n = t, t = !1) : t = !!t, (n = n || 10) < 2 || 36 < n) throw RangeError("radix");
        var e;
        if ((e = i.indexOf("-")) > 0) throw Error("interior hyphen");
        if (0 === e) return o(i.substring(1), t, n).neg();
        for (var h = s(u(n, 8)), r = c, g = 0; g < i.length; g += 8) {
            var f = Math.min(8, i.length - g), a = parseInt(i.substring(g, g + f), n);
            if (f < 8) {
                var d = s(u(n, f));
                r = r.mul(d).add(s(a));
            } else r = (r = r.mul(h)).add(s(a));
        }
        return r.unsigned = t, r;
    }
    function g(t) {
        return t instanceof i ? t : "number" == typeof t ? s(t) : "string" == typeof t ? o(t) : r(t.low, t.high, t.unsigned);
    }
    i.fromString = o, i.fromValue = g;
    var f = 4294967296, a = f * f, d = a / 2, l = h(1 << 24), c = h(0);
    i.ZERO = c;
    var v = h(0, !0);
    i.UZERO = v;
    var w = h(1);
    i.ONE = w;
    var m = h(1, !0);
    i.UONE = m;
    var N = h(-1);
    i.NEG_ONE = N;
    var p = r(-1, 2147483647, !1);
    i.MAX_VALUE = p;
    var b = r(-1, -1, !0);
    i.MAX_UNSIGNED_VALUE = b;
    var q = r(0, -2147483648, !1);
    i.MIN_VALUE = q;
    var E = i.prototype;
    return E.toInt = function() {
        return this.unsigned ? this.low >>> 0 : this.low;
    }, E.toNumber = function() {
        return this.unsigned ? (this.high >>> 0) * f + (this.low >>> 0) : this.high * f + (this.low >>> 0);
    }, E.toString = function(i) {
        if ((i = i || 10) < 2 || 36 < i) throw RangeError("radix");
        if (this.isZero()) return "0";
        if (this.isNegative()) {
            if (this.eq(q)) {
                var t = s(i), n = this.div(t), e = n.mul(t).sub(this);
                return n.toString(i) + e.toInt().toString(i);
            }
            return "-" + this.neg().toString(i);
        }
        for (var h = s(u(i, 6), this.unsigned), r = this, o = ""; ;) {
            var g = r.div(h), f = (r.sub(g.mul(h)).toInt() >>> 0).toString(i);
            if ((r = g).isZero()) return f + o;
            for (;f.length < 6; ) f = "0" + f;
            o = "" + f + o;
        }
    }, E.getHighBits = function() {
        return this.high;
    }, E.getHighBitsUnsigned = function() {
        return this.high >>> 0;
    }, E.getLowBits = function() {
        return this.low;
    }, E.getLowBitsUnsigned = function() {
        return this.low >>> 0;
    }, E.getNumBitsAbs = function() {
        if (this.isNegative()) return this.eq(q) ? 64 : this.neg().getNumBitsAbs();
        for (var i = 0 != this.high ? this.high : this.low, t = 31; t > 0 && 0 == (i & 1 << t); t--) ;
        return 0 != this.high ? t + 33 : t + 1;
    }, E.isZero = function() {
        return 0 === this.high && 0 === this.low;
    }, E.isNegative = function() {
        return !this.unsigned && this.high < 0;
    }, E.isPositive = function() {
        return this.unsigned || this.high >= 0;
    }, E.isOdd = function() {
        return 1 == (1 & this.low);
    }, E.isEven = function() {
        return 0 == (1 & this.low);
    }, E.equals = function(i) {
        return t(i) || (i = g(i)), (this.unsigned === i.unsigned || this.high >>> 31 != 1 || i.high >>> 31 != 1) && this.high === i.high && this.low === i.low;
    }, E.eq = E.equals, E.notEquals = function(i) {
        return !this.eq(i);
    }, E.neq = E.notEquals, E.lessThan = function(i) {
        return this.comp(i) < 0;
    }, E.lt = E.lessThan, E.lessThanOrEqual = function(i) {
        return this.comp(i) <= 0;
    }, E.lte = E.lessThanOrEqual, E.greaterThan = function(i) {
        return this.comp(i) > 0;
    }, E.gt = E.greaterThan, E.greaterThanOrEqual = function(i) {
        return this.comp(i) >= 0;
    }, E.gte = E.greaterThanOrEqual, E.compare = function(i) {
        if (t(i) || (i = g(i)), this.eq(i)) return 0;
        var n = this.isNegative(), e = i.isNegative();
        return n && !e ? -1 : !n && e ? 1 : this.unsigned ? i.high >>> 0 > this.high >>> 0 || i.high === this.high && i.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(i).isNegative() ? -1 : 1;
    }, E.comp = E.compare, E.negate = function() {
        return !this.unsigned && this.eq(q) ? q : this.not().add(w);
    }, E.neg = E.negate, E.add = function(i) {
        t(i) || (i = g(i));
        var n = this.high >>> 16, e = 65535 & this.high, h = this.low >>> 16, s = 65535 & this.low, u = i.high >>> 16, o = 65535 & i.high, f = i.low >>> 16, a = 0, d = 0, l = 0, c = 0;
        return l += (c += s + (65535 & i.low)) >>> 16, d += (l += h + f) >>> 16, a += (d += e + o) >>> 16, 
        a += n + u, r((l &= 65535) << 16 | (c &= 65535), (a &= 65535) << 16 | (d &= 65535), this.unsigned);
    }, E.subtract = function(i) {
        return t(i) || (i = g(i)), this.add(i.neg());
    }, E.sub = E.subtract, E.multiply = function(i) {
        if (this.isZero()) return c;
        if (t(i) || (i = g(i)), i.isZero()) return c;
        if (this.eq(q)) return i.isOdd() ? q : c;
        if (i.eq(q)) return this.isOdd() ? q : c;
        if (this.isNegative()) return i.isNegative() ? this.neg().mul(i.neg()) : this.neg().mul(i).neg();
        if (i.isNegative()) return this.mul(i.neg()).neg();
        if (this.lt(l) && i.lt(l)) return s(this.toNumber() * i.toNumber(), this.unsigned);
        var n = this.high >>> 16, e = 65535 & this.high, h = this.low >>> 16, u = 65535 & this.low, o = i.high >>> 16, f = 65535 & i.high, a = i.low >>> 16, d = 65535 & i.low, v = 0, w = 0, m = 0, N = 0;
        return m += (N += u * d) >>> 16, w += (m += h * d) >>> 16, m &= 65535, w += (m += u * a) >>> 16, 
        v += (w += e * d) >>> 16, w &= 65535, v += (w += h * a) >>> 16, w &= 65535, v += (w += u * f) >>> 16, 
        v += n * d + e * a + h * f + u * o, r((m &= 65535) << 16 | (N &= 65535), (v &= 65535) << 16 | (w &= 65535), this.unsigned);
    }, E.mul = E.multiply, E.divide = function(i) {
        if (t(i) || (i = g(i)), i.isZero()) throw Error("division by zero");
        if (this.isZero()) return this.unsigned ? v : c;
        var n, e, h;
        if (this.unsigned) {
            if (i.unsigned || (i = i.toUnsigned()), i.gt(this)) return v;
            if (i.gt(this.shru(1))) return m;
            h = v;
        } else {
            if (this.eq(q)) return i.eq(w) || i.eq(N) ? q : i.eq(q) ? w : (n = this.shr(1).div(i).shl(1)).eq(c) ? i.isNegative() ? w : N : (e = this.sub(i.mul(n)), 
            h = n.add(e.div(i)));
            if (i.eq(q)) return this.unsigned ? v : c;
            if (this.isNegative()) return i.isNegative() ? this.neg().div(i.neg()) : this.neg().div(i).neg();
            if (i.isNegative()) return this.div(i.neg()).neg();
            h = c;
        }
        for (e = this; e.gte(i); ) {
            n = Math.max(1, Math.floor(e.toNumber() / i.toNumber()));
            for (var r = Math.ceil(Math.log(n) / Math.LN2), o = r <= 48 ? 1 : u(2, r - 48), f = s(n), a = f.mul(i); a.isNegative() || a.gt(e); ) a = (f = s(n -= o, this.unsigned)).mul(i);
            f.isZero() && (f = w), h = h.add(f), e = e.sub(a);
        }
        return h;
    }, E.div = E.divide, E.modulo = function(i) {
        return t(i) || (i = g(i)), this.sub(this.div(i).mul(i));
    }, E.mod = E.modulo, E.not = function() {
        return r(~this.low, ~this.high, this.unsigned);
    }, E.and = function(i) {
        return t(i) || (i = g(i)), r(this.low & i.low, this.high & i.high, this.unsigned);
    }, E.or = function(i) {
        return t(i) || (i = g(i)), r(this.low | i.low, this.high | i.high, this.unsigned);
    }, E.xor = function(i) {
        return t(i) || (i = g(i)), r(this.low ^ i.low, this.high ^ i.high, this.unsigned);
    }, E.shiftLeft = function(i) {
        return t(i) && (i = i.toInt()), 0 == (i &= 63) ? this : i < 32 ? r(this.low << i, this.high << i | this.low >>> 32 - i, this.unsigned) : r(0, this.low << i - 32, this.unsigned);
    }, E.shl = E.shiftLeft, E.shiftRight = function(i) {
        return t(i) && (i = i.toInt()), 0 == (i &= 63) ? this : i < 32 ? r(this.low >>> i | this.high << 32 - i, this.high >> i, this.unsigned) : r(this.high >> i - 32, this.high >= 0 ? 0 : -1, this.unsigned);
    }, E.shr = E.shiftRight, E.shiftRightUnsigned = function(i) {
        if (t(i) && (i = i.toInt()), 0 == (i &= 63)) return this;
        var n = this.high;
        return i < 32 ? r(this.low >>> i | n << 32 - i, n >>> i, this.unsigned) : r(32 === i ? n : n >>> i - 32, 0, this.unsigned);
    }, E.shru = E.shiftRightUnsigned, E.toSigned = function() {
        return this.unsigned ? r(this.low, this.high, !1) : this;
    }, E.toUnsigned = function() {
        return this.unsigned ? this : r(this.low, this.high, !0);
    }, window.Long = i, i;
});